package backend.controller;

import backend.service.GetTotalCasesService;
import backend.service.ProvinceAndCityService;
import entities.*;
import org.hamcrest.core.Every;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class ProducerController {
    @Resource
    private GetTotalCasesService getTotalCasesService;
    @Resource
    private ProvinceAndCityService  provinceService;

    //    各省份的地图数据
    @RequestMapping("/detailData")
    @ResponseBody
    public MapData[] detailData(String provinceName){
        return getTotalCasesService.getDetailMapData(provinceName);
    }

    @RequestMapping("/get_total_cases")
    @ResponseBody
    public TotalCases getTotalCases(){
        return getTotalCasesService.getTotalCases();
    }

    @RequestMapping("/getAll")
    @ResponseBody
    public ProvinceAndCity[] getAll(){
        return provinceService.getAll();
    }

    @RequestMapping("/getProvince")
    @ResponseBody
    public ProvinceAndCity[] getProvince(String proName){
        return provinceService.getProvinceData(proName);
    }

    @RequestMapping("/getEveryDay")
    @ResponseBody
    public EveryDay[] getEveryDay(){
        return getTotalCasesService.getEveryDay();
    }

    @RequestMapping("/getProvinceDay")
    @ResponseBody
    public Day_province[] getProvinceDay(){
        return provinceService.getProvinceDay();
    }

    @RequestMapping("/getMapData")
    @ResponseBody
    public MapData[] getMapData(){
        return getTotalCasesService.getMapData();
    }
}
